﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace _2._17._2015_CodeFirst.Models
{
    public class Name
    {
        [Key]
        public int NameId { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }

    public class Address
    {
        [Key]
        public int AddressId { get; set; }
        public string Street { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Zip { get; set; }

        public int NameId { get; set; }
        [ForeignKey("NameId")]
        public virtual Name Name { get; set; }

        public int AddressTypeId { get; set; }
        [ForeignKey("AddressTypeId")]
        public virtual AddressType AddressType { get; set; }
    }

    public class AddressType
    {
        [Key]
        public int AddressTypeId { get; set; }
        public string Type { get; set; }
    }

    public class NameAddressViewModel
    {
        public string Name { get; set; }
        public string Street { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Zip { get; set; }
        public string Type { get; set; }
    }
}